package cn.pink.logicsrv;

import cn.pink.common.support.tools.cache.CacheTool;
import cn.pink.core.NodeType;
import cn.pink.core.Port;
import cn.pink.core.Service;
import cn.pink.core.config.CacheConfig;
import cn.pink.core.gen.lock.Lock;
import cn.pink.core.gen.proxy.DistrClass;
import cn.pink.core.gen.proxy.DistrMethod;
import cn.pink.core.support.Param;

/**
 * @Author: pink
 * @Date: 2022/6/21 16:53
 */
@DistrClass(nodeType = NodeType.LOGIC)
public class LogicService extends Service {
    public LogicService(Port port) {
        super(port);
    }

    @Override
    public Object getId() {
        return RPCProxy.LogicServiceProxy.DIST_NAME;
    }

    @DistrMethod
    @Lock
    public Param defaultHandler(String str) {
        System.out.println(str);

//        CacheTool.getInstance().getCache(CacheConfig.GROUP).put(str, str + "123");

//        CacheTool.getInstance().getCache(CacheConfig.GROUP).values().forEach(System.out::println);

//        String a = CacheTool.getInstance().getCache(CacheConfig.TEST).get(str);
//        System.out.println(a);

        return null;
    }


}
